<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <title>优你管理</title>
    <link href="/static/admin/css/bootstrap.min.css" rel="stylesheet">
    <link href="/static/admin/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="/static/admin/css/animate.css" rel="stylesheet">
    <link href="/static/admin/css/style.css" rel="stylesheet">
    <link href="/static/admin/css/login.css" rel="stylesheet">
    <link href="/static/admin/css/plugins/toastr/toastr.min.css" rel="stylesheet">
    <script>
        if(window.top!==window.self){window.top.location=window.location};
    </script>
</head>

<body class="signin">
<div class="signinpanel">
    <div class="row">
        <div class="col-sm-7" style="color:#fff">
            <div class="signin-info">
                <div class="logopanel m-b">
                    <h1>优你管理</h1>
                </div>
                <div class="m-b"></div>
                <h4>优你管理 Web Content Management Center.</h4>
                <ul class="m-b">
                    <li>
                        <i class="fa fa-arrow-circle-o-right m-r-xs"></i> 创造一流品牌 打造一流服务
                    </li>
                    <li>
                        <i class="fa fa-arrow-circle-o-right m-r-xs"></i> 速度、质量、成效
                    </li>
                    <li>
                        <i class="fa fa-arrow-circle-o-right m-r-xs"></i> 创新引领未来
                    </li>
                </ul>

            </div>
        </div>
        <div class="col-sm-5" style="color:#fff">
            <form id="doLogin" name="doLogin" method="post" action="">
                <h4 class="no-margins">Powered by 优你管理</h4>
                <input type="text" class="form-control uname" placeholder="用户名" id="user_name" name="user_name" value=""/>
                <input type="password" class="form-control pword m-b" placeholder="密码" id="password" name="password" value="" />
                <div style="margin-bottom:70px">
                    <input type="text" class="form-control" placeholder="验证码" style="color:black;width:120px;float:left;margin:0px 0px;" name="code" id="code"/>
                    <img id="verify" src="{:url('checkVerify')}" onclick="javascript:this.src='{:url('checkVerify')}?tm='+Math.random();" style="float:right;cursor: pointer"/>
                </div>
                <input class="btn btn-primary btn-block" id="login_btn" value="登录"/>
            </form>
        </div>
    </div>
    <div class="signup-footer">
        <div class="pull-left">
            <a href="javascript:;"  target="_blank"  style="color:#fff">&copy; 优你管理  V7.3</a>
        </div>
    </div>
</div>
<script src="/static/admin/js/jquery.min.js?v=2.1.4"></script>
<script src="/static/admin/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/static/admin/js/plugins/layer/layer.min.js"></script>
<script src="/static/admin/js/plugins/toastr/toastr.min.js"></script>
<script>
    document.onkeydown=function(event){
        var e = event || window.event || arguments.callee.caller.arguments[0];
        if(e && e.keyCode==13){ // enter 键
            $('#login_btn').click();
        }
    };
    toastr.options = { // toastr配置
        "closeButton": false, //是否显示关闭按钮
        "debug": false, //是否使用debug模式
        "progressBar": true, //是否显示进度条，当为false时候不显示；当为true时候，显示进度条，当进度条缩短到0时候，消息通知弹窗消失
        "positionClass": "toast-top-center",//显示的动画时间
        "showDuration": "400", //显示的动画时间
        "hideDuration": "1000", //消失的动画时间
        "timeOut": "7000", //展现时间
        "extendedTimeOut": "1000", //加长展示时间
        "showEasing": "swing", //显示时的动画缓冲方式
        "hideEasing": "linear", //消失时的动画缓冲方式
        "showMethod": "fadeIn", //显示时的动画方式
        "hideMethod": "fadeOut" //消失时的动画方式
    };
    var lock = false;

    $(function () {
        $('#login_btn').click(function () {
            if (lock){
                return;
            }
            lock=true;
            $('#login_btn').removeClass('btn-primary').addClass('btn-danger').val('登陆中...');
            var username = $('#user_name').val();
            var password = $('#password').val();
            var code = $('#code').val();
            $.post("{:url('login/doLogin')}",{'user_name':username, 'password':password, 'code':code},function(data){
                lock = false;
                $('#login_btn').val('登录').removeClass('btn-danger').addClass('btn-primary');
                if(data.code){
                   toastr.success(data.msg);
                    window.location.href='{:url("index/index")}';
                }else{
                    $('#verify').attr('src', '{:url('checkVerify')}?tm='+Math.random());
                    $('#code').val('');
                    toastr.error(data.msg);
                }
            });
        })
    })
</script>
</body>
</html>